﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BHS.Business.Models;
using BHS.Entity;

namespace BHS.Business.Handlers
{
    public class TreHandler
    {
        public List<TreModel> GetAllTre()
        {
            BHSEntities db = new BHSEntities();
            var allTre = (from t in db.Tres select t);
            if(allTre != null && allTre.Count() > 0)
            {
                var t = allTre.ToList();
                var l = new List<TreModel>();
                foreach (var tre in t)
                {
                    l.Add(new TreModel(tre));
                }
                return l;
            }
            else
            {
                return new List<TreModel>(0);
            }
        }
    }
}
